package com.example.data.factory.mapper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.data.factory.entity.entity.Dict;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 码表 Mapper 接口
 * </p>
 *
 * @author lhy
 * @since 2025-03-03
 */
public interface DictMapper extends BaseMapper<Dict> {

    @Select("SELECT COALESCE(MAX(dict_id), 0) FROM dict")
    Integer selectMaxId();
    @Select("SELECT dict_name,dict_id,dict_code from dict")
    List<Dict> list();

    @Select("SELECT d.*,d1.*  from dict d inner join dict_data d1 on d.dict_id = d1.dict_id where dict_name = #{dictName}")
    Dict selectByDictName(String dictName);
}
